project (Common)

file (GLOB COMMON_FILES
    common/*.hh
    common/*.cc)
file (GLOB LOGIC_FILES
    logic/*.hh
    logic/*.cc)
file (GLOB STATIC_FILES
    static/*.hh
    static/*.cc)
file (GLOB RENDER_FILES
    render/*.hh
    render/*.cc)
source_group (common FILES ${COMMON_FILES})
source_group (logic FILES ${LOGIC_FILES})
source_group (static FILES ${STATIC_FILES})
source_group (render FILES ${RENDER_FILES})
set (SRC_FILES ${COMMON_FILES} ${LOGIC_FILES} ${STATIC_FILES} ${RENDER_FILES})
add_precompiled_header (pch.hh pch.cc SRC_FILES)

add_library (Common STATIC ${SRC_FILES})

target_include_directories (Common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

set_target_properties (Common PROPERTIES DEBUG_POSTFIX -d)
set_target_properties (Common PROPERTIES FOLDER "srpg")

target_link_libraries (Common PUBLIC yaml-cpp tgui sfml-graphics sfml-audio)

if (NOT MSVC)
    target_link_libraries (Common PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${DL_LIBRARIES})
endif ()

if (WIN32)
    target_link_libraries (Common PUBLIC ws2_32 mswsock kernel32 user32 opengl32)
endif ()
